export default function ajax(url = '', params = {}, type = 'GET') {
  // 定义promise对象
  let promise = new Promise((resolve, reject) => {
    uni.request({
      url: url,
      data: params,
      method: type,
      header: {
        "content-type": "application/json"
      },
      success: res => {
        resolve(res)
      },
      fail: err => {
        reject(err)
      },
      complete: res =>{
        uni.hideLoading()
      }
    })
  })
  return promise
}
